@svizzle/utils/[any-any]-[array-boolean]

Methods

(static) areEqualWith(accessor) → {function}

Source:
Since:
  • 0.21.0
See:

Return a function returning true if all the items of an array are equal once processed with the provided accessor

Example
> areEqualByValue = areEqualWith(getValue)
> areEqualByValue([
	{key: 'a', value: 1},
	{key: 'b', value: 1},
	{key: 'c', value: 1},
])
true
> areEqualByValue([
	{key: 'a', value: 1},
	{key: 'b', value: 2},
	{key: 'c', value: 3},
])
false
> areEqualByValue([
	{key: 'a', value: 1},
])
false
> areEqualByValue([])
false
Parameters:
Name Type Description
accessor function
Returns:
  • Array -> Boolean
Type
function